package com.tanjor.user.dubbo.impl;

import java.io.Serializable;
import javax.annotation.Resource;

import java.util.List;
import java.util.Map;

import com.tanjor.user.dubbo.dto.SysUserDTO;
import com.tanjor.user.dubbo.dto.SysUserRoleDTO;
import com.tanjor.user.service.interfaces.ISysUserRoleService;
import com.tanjor.user.service.interfaces.ISysUserService;
import com.tanjor.user.dubbo.impl.interfaces.ISysUserDubbo;

import com.tanjor.common.datatable.PageReq;
import com.tanjor.common.datatable.PageResp;
import com.tanjor.common.exception.BusinessException;
import com.tanjor.sys.dubbo.impl.interfaces.ISysMenuDubbo;

import org.springframework.transaction.annotation.Transactional;

/**
 * <p>
 *  dubbo服务实现类
 * </p>
 *
 * @author Liuwy
 * @since 2017-03-25
 */
@Transactional
public class SysUserDubboImpl implements ISysUserDubbo{
	
	@Resource(name="SysUserServiceImpl")
	private ISysUserService service;
	
	@Resource(name="SysUserRoleServiceImpl")
	private ISysUserRoleService sysUserRoleService;
	
	@Resource
	private ISysMenuDubbo sysMenuDubbo;
	
	@Override
	public PageResp findPage(PageReq pageReq) {
		// TODO Auto-generated method stub
		return service.findPage(pageReq);
	}
	
	@Override
	public Map<String,Object> insert(SysUserDTO entityDTO) throws BusinessException{
		// TODO Auto-generated method stub	
		return service.insert(entityDTO);
	}
	
	@Override
	public Map<String,Object> update(SysUserDTO entityDTO) throws BusinessException{
		// TODO Auto-generated method stub
		return service.update(entityDTO);
	}	
	
	@Override
	public void deleteById(Serializable id) throws BusinessException{
		// TODO Auto-generated method stub
		service.deleteById(id);
	}
	
	@Override
	public SysUserDTO findById(Serializable id){
		// TODO Auto-generated method stub
		return service.findById(id);
	}

	@Override
	public Map<String, Object> saveUserRole(String userId, String userRoleCodes) {
		// TODO Auto-generated method stub
		return sysUserRoleService.saveUserRole(userId, userRoleCodes);
	}

	@Override
	public Map<String, Object> login(String userNo, String password) throws BusinessException {
		// TODO Auto-generated method stub
		return service.login(userNo, password);
	}

	@Override
	public List<SysUserRoleDTO> findByUserId(String userId) {
		// TODO Auto-generated method stub
		return sysUserRoleService.findByUserId(userId);
	}
	
}
